<script setup lang="ts">
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import Layout from '~/layout/index.vue'
import PaletteButton from '~/components/PaletteButton/index.vue'
import Cookies from "js-cookie"
import { useAuth } from '~/stores/auth/index'
const { setInfo, clearInfo } = useAuth()

onMounted(() => {
  const info = localStorage.getItem('info')
  const token = Cookies.get('token')
  if (token && info) {
    setInfo(JSON.parse(info))
  } else if (info) {
    clearInfo()
  }
})

</script>

<template>
  <el-config-provider :locale="zhCn">
    <Layout />
    <PaletteButton />
  </el-config-provider>
</template>
